package model
{
	import flash.display.DisplayObject;
	
	import model.vo.ViewVO;
	
	import org.puremvc.as3.interfaces.IProxy;
	import org.puremvc.as3.patterns.proxy.Proxy;

	public class ViewProxy extends Proxy implements IProxy
	{
		public static const NAME:String					= "ViewProxy";
		
		public function ViewProxy()
		{
			super( NAME, new ViewVO() );
		}
		
		public function setAppProperties( data:Object ):void
		{
			vo.frameColor 					= data.frameColor;
			vo.frameWeight					= data.frameWeight;
			
			vo.btnBckgrdColor 				= data.btnBckgrdColor;
			vo.btnBckgrdOverColor			= data.btnBckgrdOverColor;
			vo.btnBckgrdSelectedColor 		= data.btnBckgrdSelectedColor;
			
			vo.generalBtnColor				= data.generalBtnColor;
			vo.generalBtnOverColor			= data.generalBtnOverColor;
			vo.generalBtnSelectedColor		= data.generalBtnSelectedColor;
			
			vo.labelColor 					= data.labelColor;
			vo.labelOverColor 				= data.labelOverColor;
			vo.labelSelectedColor 			= data.labelSelectedColor;
			
			vo.tabsBckgrdColor 				= data.tabBckgrdColor;
			vo.tabsBckgrdOverColor 			= data.tabBckgrdOverColor
			vo.tabsBckgrdSelectedColor 		= data.tabBckgrdSelectedColor;
			
			vo.headerText 					= data.headerText;
			vo.headerTextFallout			= data.headerTextFallout;
			vo.usernameText 				= data.usernameText;
			vo.passwordText 				= data.passwordText;
			vo.loginText 					= data.loginText;
			vo.footerText 					= data.footerText;	
			vo.welcomeText 					= data.welcomeText;	
			vo.errorText 					= data.errorText;		
		}
		
		public function alignGUI():void
		{
			vo.headerView.y 		= Math.round( 0 );
			vo.menuView.y			= Math.round( vo.HEADER_HEIGHT );
			vo.contentView.y 		= Math.round( vo.menuView.y + vo.menuView.height );
			
			FX.translateMultipleY( [ vo.footerView, vo.progressView ],
									 ApplicationFacade.APP_HEIGHT - vo.FOOTER_HEIGHT,
								  	 translateCompleteHandler );
		}
		
		public function addComponent( component:Object ):void
		{
			vo.contentView.addComponent( component);
		}
		
		private function translateCompleteHandler():void
		{
			
			vo.footerView.y = Math.round( ApplicationFacade.APP_HEIGHT - vo.FOOTER_HEIGHT  );
			
			sendNotification( ApplicationFacade.INIT );
		}
		
		public function get vo():ViewVO
		{
			return data as ViewVO;
		}
	}
}